package ThreadDemo;

class singalton{
    private singalton(){}
    private static singalton instance=new singalton();
    public  static singalton getsingalton(){
        return instance;
    }
}
public class singal {
    public static void main(String[] args) {
        //ThreadDemo.singalton s1=new ThreadDemo.singalton();由于类的构造方法是私有的，main类不能直接访问到，所以不能直接new.作为内部类的时候可以直接new.
        singalton s= singalton.getsingalton();
    }
}
